import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-02-13
 * Time: 17:33
 */
public class TestDemo {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        while(in.hasNextLine()){
            String str=in.nextLine();
            StringBuilder stringBuilder=new StringBuilder(str.length());
            int index=-1;
          for(int i=0;i<str.length();i++){
              char ch=str.charAt(i);
              if(index==-1||ch!=stringBuilder.charAt(index)){
                  stringBuilder.append(ch);
              }else{
                  stringBuilder.deleteCharAt(index);
                  index--;
              }
          }
          if(index==-1){
              System.out.println("0");
          }else{
              System.out.println(stringBuilder);
          }
        }
    }

}
